package com.gkj.blog.controller;

import com.gkj.blog.business.service.TypeService;
import com.gkj.blog.business.vo.entity.TypeVo;
import com.gkj.blog.framework.object.ResponseVO;
import com.gkj.blog.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/type")
public class TypeController {
    @Autowired
    TypeService typeService;

    @RequestMapping("/listAll")
    public ResponseVO listAllTypes(){
        return ResultUtil.success(null,typeService.listAllType());
    }

    @PostMapping("/getType/{id}")
    public ResponseVO getType(@PathVariable Long id){
        return ResultUtil.success(null,typeService.select(id));
    }
}
